<html>
    <script> 
        window.addEventListener('message', function(e) {  
            if (e.source != window.parent) { 
                return;  
            }
            console.log(e.data);
            var data = JSON.parse(e.data);
            var res = false;;
            if (data.opr == 'get') {
                res = localStorage.getItem(data.key);
            } else if (data.opr == 'set') {
                localStorage.setItem(data.key, data.value);
                res = true;
            }
            window.parent.postMessage(JSON.stringify(res), '*');  
        }, false);
    </script>
    <body></body>
</html>